package ModelLayer;
import java.util.ArrayList;

public class PartOrder  //used to make partorder objects
{
    // instance variables - replace the example below with your own
    private int amount;
    private Product p;
    ArrayList<Serialnumber> serialList;
    
    /**
     * Constructor for objects of class PartOrder
     */
    public PartOrder(Product p, int amount, ArrayList<Serialnumber> serialList)
    {
        this.p = p;
        this.amount = amount;
        this.serialList = serialList;
    }
    
    public double getPrice()  //calculates the price of the partorder
    {
        double partPrice = p.getPrice()*amount;
        
        return partPrice;
    }
    
    public void showInfo()  //shows info about the partorder
    {
        System.out.println("Product: "+p.getProductName()+" -- amount: "+amount+" -- price: "+getPrice());
        System.out.println(" Serial number(s):");
        for(Serialnumber sN : serialList)
        {
            sN.getSerialnumber();
            System.out.println("");
        }
    }
}
